module iTimer.app.Conf ;

import iTimer.Types;

struct AppConf {
    static {
        char[] app, dir ;
    }
    static title    = "iTimer" ;
    static play_timeout  = 200 ;
    static task_timeout  = 666 ;
    static app_hVersion  = 1 ;
    static app_lVersion  = 0 ;
    static app_dbVersion  = 2 ;
    
    static void Init(){
		version( Windows) {
			wchar[512]	path;
			int i	= GetModuleFileNameW(null, path.ptr, path.length);
			char[1024]	tmp ;
			char[] _path	= Utf.toString(path[0..i], tmp);
			foreach( ref c; _path ){
				if( c is '\\' ) c = '/' ;
			}
			i	= rfind( _path, '/') ;
			assert(i !is _path.length);
			
			int j	= rfind(_path, '.');
			assert(j !is _path.length);
			app	=  _path[i+1..j].dup ;
			dir	= _path[0..i+1].dup ;

			_path[++i]	= '\0' ;
			Environment.cwd(dir);
			
		} else {
			static assert(false);
		}
    }
}